﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using TestingRule;
using RuEn;

namespace TestingRule
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            MyC mc = new MyC() { name = "Friend1", address = "1", Age = 20 };
            List<MyC> myFriends = new List<MyC>();
            myFriends.Add(mc);
            myFriends.Add(new MyC() { name = "Friend2", address = "1", Age = 20 });
            myFriends.Add(new MyC() { name = "Friend3", address = "1", Age = 20 });
            myFriends.Add(new MyC() { name = "Friend4", address = "1", Age = 20 });
            myFriends.Add(mc);

            TestBO bo = new TestBO();
            bo.Name = textBox1.Text;
            bo.Address = "test_address";
            bo.Friends = myFriends;
            bo.Validate(bo);
            if (!bo.isValid)
            {
                StringBuilder sb = new StringBuilder();
                foreach (string str in bo.BrokenRules)
                {
                    sb.AppendLine(str);
                }
                label1.Text = sb.ToString();
                
            }
        }
    }
}
